package com.fhz.day007

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.LinearLayoutManager
import com.fhz.day007.databinding.ActivityMainBinding
import com.fhz.day007.sp.SPUtil
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() , View.OnClickListener{


    var name:String by SPUtil.operation("xiaoming","123")


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
//        setContentView(R.layout.activity_main)
        val databind =
            DataBindingUtil.setContentView<ActivityMainBinding>(this, R.layout.activity_main)


        println(name)
        name = "xiaomingaxiaoming"
        println(name)





//        databind.user =  User("xx",19)
        databind.main = this

        rv.layoutManager = LinearLayoutManager(this)
        var list = mutableListOf<User>()
//        list.add(User("小明"),19)
        list.add(User("小明","http://www.qubaobei.com/ios/cf/uploadfile/132/9/8289.jpg"))
        list.add(User("小明","http://www.qubaobei.com/ios/cf/uploadfile/132/9/8289.jpg"))
        rv.adapter = MyAdapter(list)


    }

    override fun onClick(v: View?) {
        Log.i("haha","haha")
    }
}



